/**
 * 获取配方列表
 * @returns {*}
 * @constructor
 */
function GetRecipeListApi () {
    return window.RecipeApi.getRecipeList();
}

/**
 * 获取配方下的PN列表数据
 * @param taskCode
 * @returns {*}
 * @constructor
 */
function GetRecipePNListApi (taskCode) {
    return window.RecipeApi.getRecipePNList(taskCode);
}

/**
 * 根据 id 获取配方数据
 * @param id
 * @returns {*}
 * @constructor
 */
function GetRecipeApi (id) {
    return window.RecipeApi.getRecipe(id);
}

/**
 * 新增配方
 * @param _recipe
 * @returns {*}
 * @constructor
 */
function AddRecipeApi (_recipe) {
    _recipe.Id = 0;
    return window.RecipeApi.addRecipe(JSON.stringify(_recipe));
}

/**
 * 编辑配方
 * @param _recipe
 * @returns {*}
 * @constructor
 */
function EditRecipeApi (_recipe) {
    return window.RecipeApi.editRecipe(JSON.stringify(_recipe));
}

/**
 * 删除配方
 * @param id
 * @returns {*}
 * @constructor
 */
function DeleteRecipeApi (id) {
    return window.RecipeApi.deleteRecipe(id);
}

/**
 * 新增pn
 * @param id
 * @returns {*}
 * @constructor
 */
function AddPNApi (pnInfo) {
    return window.RecipeApi.addPN(JSON.stringify(pnInfo));
}

/**
 * 删除pn
 * @param id
 * @returns {*}
 * @constructor
 */
function DeletePN (PnName) {
    return window.RecipeApi.deletePN(PnName);
}

/**
 * 重新生成螺栓布局图
 * @returns {*}
 * @constructor
 */
function RegenerateBoltApi (layout) {
    layout.tb1 = layout.tb1 || 0;
    layout.tb2 = layout.tb2 || 0;
    layout.tb3 = layout.tb3 || 0;
    layout.tb4 = layout.tb4 || 0;
    layout.tb5 = layout.tb5 || 0;
    layout.tb6 = layout.tb6 || 0;
    layout.tb7 = layout.tb7 || 0;
    layout.tb8 = layout.tb8 || 0;
    return window.RecipeApi.regenerateBolt(JSON.stringify(layout));
}

/**
 * 根据 taskCode 获取所有螺栓数
 * @param taskCode
 * @returns {*}
 * @constructor
 */
function GetAllBoltsApi (taskCode, boltType) {
    return window.RecipeApi.getAllBolts(taskCode, boltType);
}

/**
 * 配置螺栓的单个点位
 * @param taskCode
 * @returns {*}
 */
function setItemBoltPrintApi (bolt) {
    bolt.BotBoltNumber = IsEmpty(bolt.BotBoltNumber) ? 0 : bolt.BotBoltNumber;
    return window.RecipeApi.setItemBoltPrint(JSON.stringify(bolt));
}

/**
 * 修改背景图片
 * @param TaskCode
 * @param ImagePath
 * @param Type
 * @returns {*}
 */
function setBackgroundImageApi (TaskCode, ImagePath, Type) {
    return window.RecipeApi.setBackgroundImage(TaskCode, ImagePath, Type);
}

/**
 * 校验螺栓数据是否正常
 * @param taskCode
 * @returns {*}
 * @constructor
 */
function CheckDataApi (taskCode) {
    return window.RecipeApi.checkData(taskCode);
}

/**
 * 获取配方
 * @param TaskCode
 * @returns {*}
 * @constructor
 */
function GetRecipeInfoByTaskCodeApi (TaskCode) {
    return window.RecipeApi.getRecipeInfoByTaskCode(TaskCode);
}

/**
 * 设置视图的补拧配置
 * @param TaskCode
 * @param Val
 * @param Type
 * @returns {*}
 * @constructor
 */
function SetViewBaseConfigApi (TaskCode, Val, Type) {
    return window.RecipeApi.setViewBaseConfig(TaskCode, parseInt(Val), Type);
}